package org.jackysoft.entity;

import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.jackysoft.entity.AbstractEntity;
import org.jackysoft.entity.User;
import org.jackysoft.util.MySqlSchema;

import com.google.common.collect.Lists;

@Entity
@Table(schema=MySqlSchema.Identifyedbase)
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
public class GroupUser extends AbstractEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3837184357466736796L;
	private User owner;
	private Collection<User> users = Lists.newArrayList();
	private String name;

	public GroupUser(User owner, String name) {
		this.owner = owner;
		this.name = name;
	}

	
	@ManyToOne
	public User getOwner() {
		return owner;
	}

	public void setOwner(User owner) {
		this.owner = owner;
	}

	@OneToMany
	public Collection<User> getUsers() {
		return users;
	}

	public void setUsers(Collection<User> users) {
		this.users = users;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}